package rendering

import (
	"context"
	"errors"
	"time"

	"github.com/grafana/grafana/pkg/models"
)

var ErrTimeout = errors.New("超时错误。您可以通过 &timeout URL 参数以秒为单位设置超时")
var ErrNoRenderer = errors.New("没找到渲染器插件，也没有配置外部渲染服务器")
var ErrPhantomJSNotInstalled = errors.New("没找到 PhantomJS 可执行程序")

type Opts struct {
	Width    int
	Height   int
	Timeout  time.Duration
	OrgId    int64
	UserId   int64
	OrgRole  models.RoleType
	Path     string
	Encoding string
	Timezone string
}

type RenderResult struct {
	FilePath string
}

type renderFunc func(ctx context.Context, options Opts) (*RenderResult, error)

type Service interface {
	Render(ctx context.Context, opts Opts) (*RenderResult, error)
}
